package main

import (
	consulr "github.com/go-kratos/kratos/contrib/registry/consul/v2"
	etcdr "github.com/go-kratos/kratos/contrib/registry/etcd/v2"
	"github.com/go-kratos/kratos/v2/registry"
	"github.com/hashicorp/consul/api"
	etcdclient "go.etcd.io/etcd/client/v3"
)

func newConsulRegistrar() (registry.Registrar, error) {
	cli, err := api.NewClient(api.DefaultConfig())
	if err != nil {
		return nil, err
	}
	r := consulr.New(cli, consulr.WithHealthCheck(false))
	return r, nil
}

func newEtcdRegistrar(cli *etcdclient.Client) (registry.Registrar, error) {
	r := etcdr.New(cli)
	return r, nil
}
